package com.asit.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

@Controller
@RequestMapping("/thymeleaf")
public class ThymeleafcoController {

    //@RequestParam String id，访问必须有参数，否则会报错
    @GetMapping("/show")
    public String toShow(String id, Map<String,String> param){
        param.put("abc","哈哈");
        param.put("str1","");
        param.put("str2",null);
        param.put("action","/show.do");
        param.put("buttonName","请先登陆");
        return "/show";
    }
    @GetMapping("/show1")
    //@RequestParam String id，访问必须有参数，否则会报错
    public ModelAndView toShow1(Model model, ModelAndView view){
        model.addAttribute("abc","哈哈");
        view.setViewName("/show");
        return view;
    }
}
